<!doctype html>
<html lang="en" xmlns:v-bind="http://www.w3.org/1999/xhtml" xmlns:v-on="http://www.w3.org/1999/xhtml" xmlns:v-model="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>

<div id="app">

    <my-component v-model="price"></my-component>

</div>


</body>
<script src="../../../vender/vue@2.4.2.js"></script>
<script>
    var myComponent={
        template:'<input ref="input" :value="value" @input="updateValue($event.target.value)"/>',
        props:['value'],
        methods:{
            updateValue: function (val) {
                console.log('val:',val);
                var formatted=val.trim().slice(0,val.indexOf('.')==-1?val.length:val.indexOf('.')+3);
                if(formatted!==val){
                    this.$refs.input.value=formatted;
                }
                this.$emit('input',Number(formatted));
            }
        }
    };

    var app=new Vue({
        el:'#app',
        data:{
            price:'100.1'
        },
        components:{
            'my-component':myComponent
        }
    });


</script>
</html>